package jsd2204.bookstore.bookserver.service.impl;

import jsd2204.bookstore.bookserver.mapper.BookMapper;
import jsd2204.bookstore.bookserver.pojo.vo.BookRankingStandardVO;
import jsd2204.bookstore.bookserver.pojo.vo.BookStandardVO;
import jsd2204.bookstore.bookserver.pojo.vo.HostRandkingVO;
import jsd2204.bookstore.bookserver.pojo.vo.ReadTestStandardVO;
import jsd2204.bookstore.bookserver.service.BookService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author jiale
 * @version 1.0
 * @description这是一个接口实现类
 * @date 2022/08/01 08:06
 **/
@Slf4j
@Service
public class BookServiceImpl implements BookService {
    @Autowired
    BookMapper mapper;

    public BookServiceImpl() {
        log.info("创建业务对象:BookServiceImpl");
    }

    @Override
    public BookStandardVO bookById(Long id) {
        BookStandardVO bookStandardVO = mapper.bookStandardVOById(id);
        return bookStandardVO;
    }

    @Override
    public ReadTestStandardVO testById(Long id) {
        ReadTestStandardVO readTestStandardVO = mapper.readTestStandardById(id);
        return readTestStandardVO;
    }

    @Override
    public List<BookRankingStandardVO> bookRanking(Long id) {
        String classify = mapper.typeById(id);
        List<BookRankingStandardVO> randkingList= mapper.bookRanking(classify);
        return randkingList;
    }

    @Override
    public List<HostRandkingVO> hostRandking() {
        List<HostRandkingVO> hostRandkingVO = mapper.hostRandking();
        return hostRandkingVO;
    }
}
